//test3.cpp
#include <iostream>
using namespace std;

int main()
{
    int array[3][3] ={1,2,3,4,8,12,7,14,21};

    // Method 1
    cout<<"Method 1:";
    for(int (&x)[3] : array)
        for(int y : x)
            cout << y <<" "; cout << endl;

    // Method 2
    cout<<"Method 2:";
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j++)
            cout << array[i][j] << " "; cout << endl;

    // Method 3
    cout<<"Method 3:";
    for (int (*x)[3]=array; x < array + 3; x++)
        for (int *y = *x; y < *x + 3; y++)
        cout << *y << " "; cout << endl;
    
    getchar();
    return 0;
}
